<form action="news.manage.php" id="form_add" name="form_add" method="post">
	<input type="hidden" name="action" value="move_class" />
	<input type="hidden" name="id_line" id="id_line" value="<tpl> $id_line </tpl>" />
    <table border="0" cellpadding="0" cellspacing="0" class="from_table">
		<tr>
			<th><tpl> $langSysNDelClassName </tpl></th>
			<td class="td rowform" colspan="2">
				<tpl> section name=loop loop=$move_class_array </tpl>
					<tpl> $move_class_array[loop].news_c_name </tpl>
				<tpl> /section </tpl>
			</td>
		</tr>
		<tr>
			<th><tpl> $langSysNMoveTo </tpl></th>
			<td class="td rowform" colspan="2"><tpl> $slCId </tpl><tpl> $langSysNCreateRemark </tpl>
			<span id="close_add_class"><a href="javascript:;" onclick="show_ajax_add_class();"><tpl> $langSysNCreateClass </tpl>&gt;&gt;</a></span>
			<span id="open_add_class" style="display:none">
				<tpl> $langSysNCreateClass </tpl> 
				<input type="text" name="ajax_class_name" id="ajax_class_name" size="10" maxlength="50" />
				<a href="javascript:;" onclick="ajax_add_class();"><tpl> $langSysNCreate </tpl></a> <a href="javascript:;" onclick="JumpClass();"><tpl> $langSysNClassManage </tpl></a>&nbsp;&nbsp;<a href="javascript:;" onclick="cancell_ajax_add_class();">&lt;&lt;</a>
			</span></td>
			<td class="vtop tips2"><label style="display:none" for="slCId" class="wrong" metaDone="true" generated="true"></label></td>
		</tr>
  </table>
  <div class="table-5-bottom">
				<div class="p-left">
					<span class="btn_left"><input type="submit" class="btn_submit" name="Submit" value="<tpl> $langSysNMoveAndDel </tpl>" /></span>
					<span class="btn_left"><input type="button" class="btn_submit" name="return_list" id="return_list" value="<tpl> $langSysNReturn </tpl>" /></span>
				</div>
			</div>
</form>

<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-

top:10px; padding-bottom:10px"><tpl> $langSysNJumpToClassManage </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
</div>

<script>
$(document).ready(function() {
	//添加
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ST(2,2);
								ShowDiv	= 'result_content';
								getPageContent("news.manage.php?action=ajax_class_list");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	//对添加表单做的验证定义
	$("#form_add").validate({
		errorClass: "wrong",
		rules: {
			slCId: {required: true,number: true,min: 1}
		},
		messages: {
			slCId: {required: "<tpl> $errSysNSelMoveClass </tpl>",number: "<tpl> $errSysNSelMoveClass </tpl>",min: "<tpl> $errSysNSelMoveClass </tpl>"}
		},
		submitHandler: function() {
			$('#form_add').ajaxSubmit(options);
		}
	});
	
	$("#return_list").click(function(){
		ST(2,2);
		ShowDiv	= 'result_content';
		getPageContent("news.manage.php?action=ajax_class_list");
	});
	
	//跳转到类别页面
	$('#yes').click(function() {
		$.unblockUI();
		ST(2,2);
		ShowDiv	= 'result_content';
		getPageContent("news.manage.php?action=ajax_class_list");
		return false;
	});
	$('#no').click($.unblockUI);
});

//显示添加类别层
function show_ajax_add_class(){
	$("#close_add_class").css("display","none");
	$("#open_add_class").css("display","");
}

//取消添加类别层
function cancell_ajax_add_class(){
	$("#close_add_class").css("display","");
	$("#open_add_class").css("display","none");
}

//添加类别动作
function ajax_add_class(){
	//去左右空格
	var str = $("#ajax_class_name").val();
	str = str.replace(/(\s*$)/g,  "");  
	str = str.replace(/(^\s*)/g,  "");  

	if(str.length <= 0){
		alert('<tpl> $errSysNClassIsEmpty </tpl>');
		return false;
	}else{
		add_class(str);
	}
}

//添加类别
function add_class(str){
	$.ajax({
		url: "news.manage.php",
		data: "action=save_class&return_sign=1&txttitle="+str,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			if(msg.type == '1'){
				//将新添加的分类，添加到下拉列表中，并且选中这个选项
				$("#slCId").append( "<option selected=\"selected\" value=\""+msg.message+"\">"+str+"</option>" );
				cancell_ajax_add_class();
			}else{//返回错误信息
				showMessage(msg.message,msg.type);
			}
		}
	});
	return false;
}
//跳转到类别列表
var question = $('#question')[0];
function JumpClass(){
	$.blockUI(question, { width: '275px' });
}
</script>